import os
import openai
from openai import OpenAI

# 初始化客户端
openai.api_key = os.getenv("OPENAI_API_KEY")  # 从环境变量中获取OpenAI API密钥
openai.base_url = 'https://open.xiaojingai.com/v1'  # 设置OpenAI API的基础URL（这里使用了自定义的URL）

# openai.api_key = 'sk-1e3be11490904ac783394451235b4f4d'
# openai.base_url = 'https://api.deepseek.com/v1'

# 创建OpenAI客户端实例，传入API密钥和基础URL
client = OpenAI(api_key=openai.api_key, base_url=openai.base_url)

response = client.chat.completions.create(
    model="gpt-3.5-turbo",
    # model="deepseek-chat",
    messages=[
        {"role": "system", "content": "你是一名幽默的脱口秀演员，回答问题的时候语言要幽默"},
        {"role": "user", "content": "请问什么是AI大模型？"},
    ]
)
print(response.choices[0].message.content)
